home *** CD-ROM | disk | FTP | other *** search
/ VisualFX for ImageFX / VisualFX for Image FX 2.adf / Files / ARexx / 02 / 04.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1996-02-04  |  7.0 KB  |  315 lines

  1. /*
  2.                           Visual FX Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1997 Merlin's Software
  5. */
  6.  
  7. Options Results
  8. address "IMAGEFX.1"
  9. ScreenToFront
  10. Undo Off
  11. if exists("libs:flyer.library") then do
  12.     TOASTERLIB="ToasterARexx.port"
  13.     call remlib('ToasterARexx.port')
  14.     call remlib('PROJECT_REXX_PORT')
  15.     call addlib('PROJECT_REXX_PORT' , 0)
  16.     call addlib(TOASTERLIB,0)
  17.     end
  18.     call Settings()
  19.     call open TempFile,"VFXIFX:TempDrawer/"FXNum".txt",R
  20.     line = readln(TempFile)
  21.     Color = strip(line)
  22.     line = readln(TempFile)
  23.     ColorPic = strip(line)
  24.     line = readln(TempFile)
  25.     PicName = strip(line)
  26.     line = readln(TempFile)
  27.     Scroll = strip(line)
  28.     line = readln(TempFile)
  29.     XOff = strip(line)
  30.     line = readln(TempFile)
  31.     YOff = strip(line)
  32.     line = readln(TempFile)
  33.     TurnD = strip(line)
  34.     call close (TempFile)
  35.     ActiveColor Color
  36.     ActiveColor
  37.     j = 0
  38.     TFrames = Frames
  39.     if Field = 1 then TFrames = Frames*2
  40.     do i = 1 to Frames
  41.         call open TempFile,"RAM:VFXNums",W
  42.         call writeln TempFile,right(i,5,'0')
  43.         call writeln TempFile,right(Frames,5,'0')
  44.         call close TempFile
  45.         f = 0
  46.         Redraw Off
  47.         FieldSet = 0
  48.         if Padding ~= -1 & i = 1 then call PadIt(1)
  49.         call LoadB()
  50.         call LoadA()
  51.         j = j + 1
  52.         call DoIt()
  53.         Redraw On
  54.         call SaveIt()
  55.         if Field = 1 then do
  56.             Redraw Off
  57.             FieldSet = 1
  58.             call LoadB()
  59.             call LoadA()
  60.             j = j + 1
  61.             call DoIt()
  62.             Redraw On
  63.             call SaveIt()
  64.             end 
  65.         if Padding ~= -1 & i = Frames then call PadIt(2)
  66.         end
  67.     if SaveType = 0 then do
  68.         if Padding = -1 then
  69.             call MakeIcon(SaveName,(Frames-10))
  70.         else
  71.             call MakeIcon(SaveName,(Padding+(Frames-10)))
  72.         end
  73.     ActiveColor 1
  74.     ActiveColor
  75.     Undo On
  76. exit
  77.  
  78.  
  79. PadIt:
  80. arg PadNum
  81.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  82.         Undo On
  83.         exit
  84.         end
  85.          if PadNum = 1 then do
  86.        if IAType = 0 then do
  87.         do Pad = Padding to 1 by -1
  88.             LoadBuffer PicAName Force StartA-(Pad-1)
  89.             call Switcher(TOSW)
  90.             call Switcher(MDV1)
  91.             Render Go
  92.                 call RecordAdd(SaveName,2,6,Compression)
  93.             end
  94.         end
  95.        if IAType = 1 then do
  96.         LoadBuffer PicAName Force 1
  97.         call Switcher(TOSW)
  98.         call Switcher(MDV1)
  99.         Render Go
  100.             call RecordAdd(SaveName,2*Padding,6,Compression)
  101.         end
  102.        if IAType = 2 then do
  103.         LoadBuffer PicAName Force
  104.         call Switcher(TOSW)
  105.         call Switcher(MDV1)
  106.         Render Go
  107.             call RecordAdd(SaveName,2*Padding,6,Compression)
  108.         end
  109.        if IAType = 3 then do
  110.         do Pad = Padding to 1 by -1
  111.             LoadBuffer PicAName""right(StartA-(Pad-1),3,'0') Force
  112.             call Switcher(TOSW)
  113.             call Switcher(MDV1)
  114.             Render Go
  115.                 call RecordAdd(SaveName,2,6,Compression)
  116.             end
  117.         end
  118.     end 
  119.     else do
  120.        if IBType = 0 then do
  121.         do Pad = 1 to Padding
  122.             LoadBuffer PicBName Force StartB+Pad+Frames
  123.             call Switcher(TOSW)
  124.             call Switcher(MDV1)
  125.             Render Go
  126.                 call RecordAdd(SaveName,2,6,Compression)
  127.             end
  128.         end
  129.        if IBType = 1 then do
  130.         LoadBuffer PicBName Force 1
  131.         call Switcher(TOSW)
  132.         call Switcher(MDV1)
  133.         Render Go
  134.             call RecordAdd(SaveName,2*Padding,6,Compression)
  135.         end
  136.        if IBType = 2 then do
  137.         LoadBuffer PicBName Force
  138.         call Switcher(TOSW)
  139.         call Switcher(MDV1)
  140.         Render Go
  141.             call RecordAdd(SaveName,2*Padding,6,Compression)
  142.         end
  143.        if IBType = 3 then do
  144.         do Pad = 1 to Padding
  145.             LoadBuffer PicBName""right(StartB+Pad+Frames),3,'0') Force
  146.             call Switcher(TOSW)
  147.             call Switcher(MDV1)
  148.             Render Go
  149.                 call RecordAdd(SaveName,2,6,Compression)
  150.             end
  151.         end
  152.     end
  153. return
  154.  
  155. LoadA:
  156.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  157.         Undo On
  158.         exit
  159.         end
  160.     if i > Frames/2 then return
  161.     if IAType = 0 then do
  162.         LoadBuffer PicAName Force i+StartA
  163.         GetMain
  164.         parse var result Name Width Height Blah
  165.         if FieldSet = 0 then do
  166.             Hook DeInterlace
  167.             Scale Width Height
  168.             end
  169.         if FieldSet = 1 then do
  170.             Hook DeInterlace
  171.             Swap
  172.             Scale Width Height
  173.             end
  174.         end
  175.     if IAType = 1 then do
  176.         LoadBuffer PicAName Force 1
  177.         end
  178.     if IAType = 2 then do
  179.         LoadBuffer PicAName Force
  180.         end
  181.     if IAType = 3 then do
  182.         LoadBuffer PicAName""right(i+StartA,3,'0') Force
  183.         end
  184. return
  185.  
  186. LoadB:
  187.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  188.         Undo On
  189.         exit
  190.         end
  191.     if i <= Frames/2 then return
  192.     if IBType = 0 then do
  193.         LoadBuffer PicBName Force i+StartB
  194.         GetMain
  195.         parse var result Name Width Height Blah
  196.         if FieldSet = 0 then do
  197.             Hook DeInterlace
  198.             Scale Width Height
  199.             end
  200.         if FieldSet = 1 then do
  201.             Hook DeInterlace
  202.             Swap
  203.             Scale Width Height
  204.             end
  205.         end
  206.     if IBType = 1 then do
  207.         LoadBuffer PicBName Force 1
  208.         end
  209.     if IBType = 2 then do
  210.         LoadBuffer PicBName Force
  211.         end
  212.     if IBType = 3 then do
  213.         LoadBuffer PicBName""right(i+StartB,3,'0') Force
  214.         end
  215.  
  216.  
  217. return
  218.  
  219.  
  220. DoIt:
  221.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  222.         Undo On
  223.         exit
  224.         end
  225.         
  226.     if j = 1 then do
  227.         return
  228.         end
  229.  
  230.     if j = TFrames then do
  231.         return
  232.         end
  233.  
  234.         ByNum = 180
  235.     NewNum = ((j-1)*ByNum)/((TFrames/2)-1)
  236.     NewNum = trunc(NewNum)
  237.     if j > (TFrames/2) then
  238.         NewNum = ((ByNum -(((j-1) * ByNum)/(TFrames-1)))%1)*2
  239.     NewNum = trunc(NewNum)
  240.  
  241.         ByNum2 = 100
  242.     NewNum2 = ((j-1)*ByNum2)/((TFrames/2)-1)
  243.     NewNum2 = trunc(NewNum2)
  244.     if j > (TFrames/2) then
  245.         NewNum2 = ((ByNum2 -(((j-1) * ByNum2)/(TFrames-1)))%1)*2
  246.     NewNum2 = trunc(NewNum2)
  247.  
  248.     NewNum = -NewNum
  249.     NewNum2 = -NewNum2
  250.     if ColorPic = 1 then do
  251.         Swap
  252.         LoadBuffer PicName Force
  253.         if Scroll = 1 then
  254.             Roll XOff*j YOff*j
  255.         Swap
  256.         end
  257.  
  258.     if TurnD = 1 then NewNum = -NewNum
  259.     if TurnD = 3 then NewNum = -NewNum
  260.  
  261.     if ColorPic = 1 then do
  262.         if TurnD = 0 then Hook Perspective '0' '0' '0' NewNum '0' '0' '0' '0' -2 0 -1 0 SwapTile AntiAlias
  263.         if TurnD = 1 then Hook Perspective '0' '0' '0' NewNum '0' '0' '0' '0' -2 0 -1 0 SwapTile AntiAlias
  264.         if TurnD = 2 then Hook Perspective '0' '0' '0' '0' NewNum '0' '0' '0' -2 0 -1 0 SwapTile AntiAlias
  265.         if TurnD = 3 then Hook Perspective '0' '0' '0' '0' NewNum '0' '0' '0' -2 0 -1 0 SwapTile AntiAlias
  266.         if TurnD = 4 then Hook Perspective '0' '0' '0' '0' '0' NewNum NewNum2 NewNum2 1 1 1 0 SwapTile AntiAlias
  267.         end
  268.     else do
  269.         if TurnD = 0 then Hook Perspective '0' '0' '0' NewNum '0' '0' '0' '0' -2 0 -1 0 DrawColor AntiAlias
  270.         if TurnD = 1 then Hook Perspective '0' '0' '0' NewNum '0' '0' '0' '0' -2 0 -1 0 DrawColor AntiAlias
  271.         if TurnD = 2 then Hook Perspective '0' '0' '0' '0' NewNum '0' '0' '0' -2 0 -1 0 DrawColor AntiAlias
  272.         if TurnD = 3 then Hook Perspective '0' '0' '0' '0' NewNum '0' '0' '0' -2 0 -1 0 DrawColor AntiAlias
  273.         if TurnD = 4 then Hook Perspective '0' '0' '0' '0' '0' NewNum NewNum2 NewNum2 1 1 1 0 DrawColor AntiAlias
  274.         end
  275. return
  276.  
  277. SaveIt:
  278.     if (POS('FLY_1',SHOW('Ports')) = 0) then do
  279.         Undo On
  280.         exit
  281.         end
  282.     if SaveType = 0 then do
  283.         call Switcher(TOSW)
  284.         call Switcher(MDV1)
  285.         Render Go
  286.         if Field = 1 then
  287.                 call RecordAdd(SaveName,1,6,Compression)
  288.         else
  289.                 call RecordAdd(SaveName,2,6,Compression)
  290.         end
  291.     if SaveType = 1 then do
  292.         if Field = 1 then do
  293.             f= f + 1
  294.             if f = 1 then
  295.                 SaveBufferAs ILBM "VFXIFX:TempDrawer/PicA"
  296.             if f = 2 then do
  297.                 GetMain
  298.                 parse var result Name Width Height Blah
  299.                 Scale Width Height/2
  300.                 Swap
  301.                 LoadBuffer "VFXIFX:TempDrawer/PicA" Force
  302.                 Scale Width Height/2
  303.                 Hook Interlace
  304.                 SaveBufferAs ILBM SaveName""right(i,3,'0')
  305.                 f = 0
  306.                 end
  307.             end
  308.         else do
  309.             SaveBufferAs ILBM SaveName""right(i,3,'0')
  310.             end    
  311.         end
  312.  
  313. return
  314.  
  315.